
local cmdname = "aids_mute"

if CLIENT then
	
	local args = { { Name = "Toggle On", Value = { "muted.", true } },
	{ Name = "Toggle Off", Value = { "un-muted.", false } } }
	
	AIDS.RegisterCommand( "Mute", cmdname, "mute", args ) 
	
	local function ChatHook( ply, team, istext, isdead )
	
		if ply:GetNWBool( "AIDS_hushed", false ) then
		
			return true
		
		end
	
	end
	
	function VoiceHook( listener, talker )
	
		if talker:GetNWBool( "AIDS_hushed", false ) then
		
			return false
		
		end
	
	end
	
	AIDS.Hook( "OnPlayerChat", cmdname, ChatHook )
	AIDS.Hook( "PlayerCanHearPlayersVoice", cmdname, VoiceHook )
	
else
	
	local function MutePlayer( ply, cmd, args )
	
		local target = AIDS.GetPlayer( args[1] )
		
		if target then
		
			target:SetNWBool( "AIDS_hushed", tobool( args[3] ) )
			
			AIDS.ChatPrint( { target, " was " .. args[2] } )
		
		end
	
	end
	
	AIDS.AddCommand( MutePlayer, cmdname )
	
end